
import {defineStore} from 'pinia'

const store = defineStore('topListTracks', {
	state: ()=>{
		return {
			topListIds: [],
			nextId: 0
		}
	},
	actions: {
		updateTopListIds(trackIds){
			this.topListIds = trackIds;
		},
		setNextId(id){
			for(let i = 0; i < this.topListIds.length; i++){
				if(i == this.topListIds.length - 1){
					this.nextId = this.topListIds[0].id
					break;
				}
				if(this.topListIds[i].id == id){
					this.nextId = this.topListIds[i+1].id
				}
			}
		},
	}
})


export default store